Public Class ScanSchedule
    Inherits Base

    Public Enum Type As Long
        SchemaScan = 1
        SizeScan = 2
        BlockScan = 3
        ConnectionScan = 4
        WaitStateScan = 5
    End Enum

    Private mlServerID As Long
    Private mlDatabaseID As Long
    Private mlScanTypeID As Long
    Private mlScanTypeMinutes As Long
    Private mbSendReport As Boolean

    Public Sub New()
        MyBase.New()

        Dim oNextID As New DBNextIDValue("ScanSchedule")
        Dim lNextID As Long = oNextID.NextValue

        Me.ID = lNextID
    End Sub

    Public Sub New( _
                ByVal lID As Long)

        MyBase.New(lID)
    End Sub

#Region "Properties"
    Public Property ServerID() As Long
        Get
            Return mlServerID
        End Get
        Set(ByVal value As Long)
            mlServerID = value
        End Set
    End Property

    Public Property DatabaseID() As Long
        Get
            Return mlDatabaseID
        End Get
        Set(ByVal value As Long)
            mlDatabaseID = value
        End Set
    End Property

    Public Property ScanTypeID() As Type
        Get
            Return mlScanTypeID
        End Get
        Set(ByVal value As Type)
            mlScanTypeID = value
        End Set
    End Property

    Public Property ScanTypeMinutes() As Long
        Get
            Return mlScanTypeMinutes
        End Get
        Set(ByVal value As Long)
            mlScanTypeMinutes = value
        End Set
    End Property

    Public Property SendReport() As Boolean
        Get
            Return mbSendReport
        End Get
        Set(ByVal value As Boolean)
            mbSendReport = value
        End Set
    End Property
#End Region

#Region "database"
    Public Sub Load()
        Dim oObject As New DBScanSchedule

        oObject.Load(Me)
    End Sub

    Public Sub Save()
        Dim oObject As New DBScanSchedule

        If mbObjectExists = True Then
            oObject.Update(Me)
        Else
            Me.CreateDate = Now
            oObject.Add(Me)
            mbObjectExists = True
        End If
    End Sub

    Public Sub Delete()
        Dim oObject As New DBScanSchedule

        oObject.Delete(Me)
        mbObjectExists = False
    End Sub
#End Region

End Class
